<template>
  <div class="dashboard">
    <!-- 欢迎信息 -->
    <div class="welcome">
      <div class="welcome-content">
        <div class="welcome-bg"></div>
        <h1>欢迎您, 进入轻客管家系统</h1>
        <div class="decorative-dots"></div>
      </div>
    </div>
    
    <!-- 统计概览 -->
    <div class="overview-container">
      <!-- 线索概览 -->
      <div class="overview-card tech-card">
        <div class="card-header">
          <h3>线索概览</h3>
          <div class="glow-indicator线索"></div>
        </div>
        <div class="stats-grid">
          <div class="stat-item tech-stat-item">
            <div class="stat-label">总线索数</div>
            <div class="stat-value tech-value">10</div>
          </div>
          <div class="stat-item tech-stat-item">
            <div class="stat-label">待分配线索数</div>
            <div class="stat-value tech-value highlight">3</div>
          </div>
          <div class="stat-item tech-stat-item">
            <div class="stat-label">待跟进线索数</div>
            <div class="stat-value tech-value highlight">2</div>
          </div>
          <div class="stat-item tech-stat-item">
            <div class="stat-label">跟进中线索数</div>
            <div class="stat-value tech-value">2</div>
          </div>
          <div class="stat-item tech-stat-item">
            <div class="stat-label">伪线索数</div>
            <div class="stat-value tech-value">1</div>
          </div>
          <div class="stat-item tech-stat-item">
            <div class="stat-label">转商机线索数</div>
            <div class="stat-value tech-value success">2</div>
          </div>
        </div>
      </div>
      
      <!-- 商机概览 -->
      <div class="overview-card tech-card">
        <div class="card-header">
          <h3>商机概览</h3>
          <div class="glow-indicator商机"></div>
        </div>
        <div class="stats-grid">
          <div class="stat-item tech-stat-item">
            <div class="stat-label">总商机数</div>
            <div class="stat-value tech-value">10</div>
          </div>
          <div class="stat-item tech-stat-item">
            <div class="stat-label">待分配商机数</div>
            <div class="stat-value tech-value highlight">3</div>
          </div>
          <div class="stat-item tech-stat-item">
            <div class="stat-label">待跟进商机数</div>
            <div class="stat-value tech-value highlight">2</div>
          </div>
          <div class="stat-item tech-stat-item">
            <div class="stat-label">跟进中商机数</div>
            <div class="stat-value tech-value">2</div>
          </div>
          <div class="stat-item tech-stat-item">
            <div class="stat-label">回收商机数</div>
            <div class="stat-value tech-value">1</div>
          </div>
          <div class="stat-item tech-stat-item">
            <div class="stat-label">转客户商机数</div>
            <div class="stat-value tech-value success">2</div>
          </div>
        </div>
      </div>
    </div>
    
    <!-- 功能卡片 -->
    <div class="function-cards">
      <div class="tech-card function-card" @click="navigateTo('/course')">
        <div class="card-icon">📚</div>
        <div class="card-content">
          <h4>课程管理</h4>
          <p>课程信息维护</p>
        </div>
        <div class="card-hover-effect"></div>
      </div>
      
      <div class="tech-card function-card" @click="navigateTo('/activity')">
        <div class="card-icon">🚀</div>
        <div class="card-content">
          <h4>活动管理</h4>
          <p>营销活动管理</p>
        </div>
        <div class="card-hover-effect"></div>
      </div>
      
      <div class="tech-card function-card" @click="navigateTo('/clue/list')">
        <div class="card-icon">🎯</div>
        <div class="card-content">
          <h4>线索管理</h4>
          <p>潜在客户跟踪</p>
        </div>
        <div class="card-hover-effect"></div>
      </div>
      
      <div class="tech-card function-card" @click="navigateTo('/business/list')">
        <div class="card-icon">💰</div>
        <div class="card-content">
          <h4>商机管理</h4>
          <p>销售机会管理</p>
        </div>
        <div class="card-hover-effect"></div>
      </div>
      
      <div class="tech-card function-card" @click="navigateTo('/customer')">
        <div class="card-icon">👥</div>
        <div class="card-content">
          <h4>客户管理</h4>
          <p>客户信息维护</p>
        </div>
        <div class="card-hover-effect"></div>
      </div>
      
      <div class="tech-card function-card" @click="navigateTo('/log')">
        <div class="card-icon">📊</div>
        <div class="card-content">
          <h4>日志统计</h4>
          <p>系统操作日志</p>
        </div>
        <div class="card-hover-effect"></div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { useRouter } from 'vue-router'
import { onMounted } from 'vue'

const router = useRouter()

const navigateTo = (path) => {
  router.push(path)
}

// 添加页面加载动画效果
onMounted(() => {
  setTimeout(() => {
    document.querySelectorAll('.tech-card').forEach((card, index) => {
      setTimeout(() => {
        card.classList.add('visible')
      }, index * 100)
    })
  }, 100)
})
</script>

<style scoped>
/* 科技感主题样式 */
.dashboard {
  padding: 20px;
  background: #0d1117;
  min-height: 100%;
}

/* 欢迎区域 */
.welcome {
  margin-bottom: 30px;
  position: relative;
}

.welcome-content {
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: 40px 20px;
  border-radius: 12px;
  background: linear-gradient(135deg, #161b22 0%, #0d1117 100%);
  border: 1px solid #30363d;
}

.welcome-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 50% 50%, rgba(88, 166, 255, 0.1) 0%, transparent 70%);
  z-index: 1;
}

.welcome h1 {
  font-size: 28px;
  color: #58a6ff;
  text-align: center;
  margin: 0;
  position: relative;
  z-index: 2;
  font-weight: 600;
  text-shadow: 0 0 10px rgba(88, 166, 255, 0.3);
}

.decorative-dots {
  position: absolute;
  top: 10px;
  right: 10px;
  bottom: 10px;
  left: 10px;
  z-index: 1;
  background-image: 
    radial-gradient(rgba(88, 166, 255, 0.1) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
}

/* 统计概览区域 */
.overview-container {
  display: flex;
  gap: 20px;
  margin-bottom: 30px;
}

.tech-card {
  flex: 1;
  border: 1px solid #30363d;
  border-radius: 12px;
  padding: 20px;
  background: rgba(22, 27, 34, 0.8);
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.5s ease-out;
  backdrop-filter: blur(10px);
}

.tech-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  position: relative;
}

.card-header h3 {
  margin: 0;
  font-size: 18px;
  color: #c9d1d9;
  font-weight: 600;
}

.glow-indicator线索 {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #58a6ff;
  box-shadow: 0 0 10px #58a6ff, 0 0 20px rgba(88, 166, 255, 0.5);
  animation: pulse 2s infinite;
}

.glow-indicator商机 {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3fb950;
  box-shadow: 0 0 10px #3fb950, 0 0 20px rgba(63, 185, 80, 0.5);
  animation: pulse 2s infinite;
}

/* 统计网格 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
}

.tech-stat-item {
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 15px;
  text-align: center;
  background: rgba(13, 17, 23, 0.5);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.tech-stat-item:hover {
  border-color: #58a6ff;
  background: rgba(88, 166, 255, 0.05);
}

.tech-stat-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #58a6ff, transparent);
  transform: translateX(-100%);
  transition: transform 0.5s ease;
}

.tech-stat-item:hover::before {
  transform: translateX(100%);
}

.stat-label {
  font-size: 14px;
  color: #8b949e;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tech-value {
  font-size: 22px;
  font-weight: bold;
  color: #c9d1d9;
  transition: all 0.3s ease;
}

.tech-value.highlight {
  color: #58a6ff;
  text-shadow: 0 0 5px rgba(88, 166, 255, 0.3);
}

.tech-value.success {
  color: #3fb950;
  text-shadow: 0 0 5px rgba(63, 185, 80, 0.3);
}

/* 功能卡片区域 */
.function-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.function-card {
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  height: 150px;
  padding: 20px;
  border: 1px solid #30363d;
  border-radius: 12px;
  background: rgba(22, 27, 34, 0.8);
  position: relative;
  overflow: hidden;
}

.function-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #58a6ff, #1d6fe2, #58a6ff);
  transform: translateX(-100%);
  transition: transform 0.5s ease;
}

.function-card:hover {
  transform: translateY(-5px);
  border-color: #58a6ff;
  box-shadow: 0 8px 25px rgba(88, 166, 255, 0.15);
  background: rgba(22, 27, 34, 0.95);
}

.function-card:hover::before {
  transform: translateX(100%);
}

.card-icon {
  font-size: 32px;
  margin-bottom: 15px;
  transition: transform 0.3s ease;
}

.function-card:hover .card-icon {
  transform: scale(1.1) rotate(5deg);
}

.card-content {
  z-index: 1;
}

.card-content h4 {
  margin: 0 0 8px 0;
  font-size: 18px;
  color: #c9d1d9;
  font-weight: 600;
}

.card-content p {
  margin: 0;
  font-size: 14px;
  color: #8b949e;
}

.card-hover-effect {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(88, 166, 255, 0.2) 0%, transparent 70%);
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.function-card:hover .card-hover-effect {
  width: 200%;
  height: 200%;
}

/* 动画效果 */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.2);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 响应式调整 */
@media (max-width: 1200px) {
  .function-cards {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .overview-container {
    flex-direction: column;
  }
  
  .function-cards {
    grid-template-columns: 1fr;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
}
</style>